Fix compiler warnings
authorJustin Burkett <justin@burkett.cc>
Wed, 30 Jun 2021 12:17:03 +0000 (08:17 -0400)
committerJustin Burkett <justin@burkett.cc>
Wed, 30 Jun 2021 12:17:03 +0000 (08:17 -0400)
Fixes #312

which-key.el

index 1213d14a833937c3d898b1071eb1a7012f699a88..ff0db279ed730c3e696485aba80fb7d240d505a0 100644 (file)
@@ -717,9 +717,20 @@ update.")
          (goto-char (point-max))
          (insert "\n" fmt-msg "\n")))))
 
+(defsubst which-key--safe-lookup-key (keymap key)
+  "Version of `lookup-key' that allows KEYMAP to be nil.
+Also convert numeric results of `lookup-key' to nil. KEY is not
+checked."
+  (when (keymapp keymap)
+    (let ((result (lookup-key keymap key)))
+      (when (and result (not (numberp result)))
+        result))))
+
 ;;; Third-party library support
 ;;;; Evil
 
+(defvar evil-state nil)
+
 (defcustom which-key-allow-evil-operators (boundp 'evil-this-operator)
   "Allow popup to show for evil operators.
 The popup is normally inhibited in the middle of commands, but
@@ -1440,15 +1451,6 @@ local bindings coming first. Within these categories order using
   "If MAYBE-STRING is a string use `which-key--string-width' o/w return 0."
   (if (stringp maybe-string) (string-width maybe-string) 0))
 
-(defsubst which-key--safe-lookup-key (keymap key)
-  "Version of `lookup-key' that allows KEYMAP to be nil.
-Also convert numeric results of `lookup-key' to nil. KEY is not
-checked."
-  (when (keymapp keymap)
-    (let ((result (lookup-key keymap key)))
-      (when (and result (not (numberp result)))
-        result))))
-
 (defsubst which-key--butlast-string (str)
   (mapconcat #'identity (butlast (split-string str)) " "))
 
@@ -1702,7 +1704,7 @@ return the docstring."
           (t
            (format "%s %s" current docstring)))))
 
-(defun which-key--format-and-replace (unformatted &optional prefix preserve-full-key)
+(defun which-key--format-and-replace (unformatted &optional preserve-full-key)
   "Take a list of (key . desc) cons cells in UNFORMATTED, add
 faces and perform replacements according to the three replacement
 alists. Returns a list (key separator description)."
@@ -1851,7 +1853,7 @@ non-nil, then bindings are collected recursively for all prefixes."
     (when which-key-sort-order
       (setq unformatted
             (sort unformatted which-key-sort-order)))
-    (which-key--format-and-replace unformatted prefix recursive)))
+    (which-key--format-and-replace unformatted recursive)))
 
 ;;; Functions for laying out which-key buffer pages